package edu.uci.ics.ai.maze.controllers;

import edu.uci.ics.ai.maze.algorithms.BreadthFirstSearch;
import edu.uci.ics.ai.maze.algorithms.DepthFirstSearch;
import edu.uci.ics.ai.maze.models.SearchAlgorithm;
import edu.uci.ics.ai.maze.utils.SystemUtils;
import java.util.LinkedList;
import java.util.List;

/**
 *  Launches the Maze Solver and loads all search algorithms
 */
public class Main {

  /**
   * Returns the list of algorithm instances to use
   * @return the search algorithms
   */
  public static List<SearchAlgorithm> getAlgorithms() {
    List<SearchAlgorithm> list = new LinkedList<SearchAlgorithm>();

    // TODO add algorithms here
    list.add(new BreadthFirstSearch());
    list.add(new DepthFirstSearch());

    return list;
  }

  public static void main(String args[]) {
    if (SystemUtils.IS_MAC_OS_X) {  // Note this must be done before awt starts up
      setMacLookAndFeel();
    }

    Game game = new Game();
    game.registerAlgorithms(getAlgorithms());
    game.display();
  }

  private static void setMacLookAndFeel() {
    // see http://developer.apple.com/mac/library/documentation/Java/Reference/Java_PropertiesRef/Articles/JavaSystemProperties.html#//apple_ref/doc/uid/TP40008047
    System.out.println("Detected Mac OS X");
    // put JMenuBar on the Mac menu bar
    System.setProperty("apple.laf.useScreenMenuBar", "true");
    // set the application name on the mac menu bar
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Maze Solver");
    // System.setProperty("com.apple.mrj.application.growbox.intrudes","false");
    System.setProperty("apple.awt.brushMetalLook", "true");
    System.setProperty("apple.awt.antialiasing", "on");
  }
}
